package com.ldc.commonlibs.http.conf

import android.util.Log
import okhttp3.logging.HttpLoggingInterceptor

class LogConf : HttpLoggingInterceptor.Logger {
    private val TAG: String = "${javaClass::getName}"

    companion object {
        fun getLoggger(level: HttpLoggingInterceptor.Level): HttpLoggingInterceptor =
            HttpLoggingInterceptor(LogConf()).apply {
                this.level = level
            }

        fun getLoggger(): HttpLoggingInterceptor = getLoggger(HttpLoggingInterceptor.Level.BODY)
    }

    override fun log(message: String) {
        Log.e(TAG, "请求日志 $message")
    }
}